<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <meta name="author" content="PG-Strom Development Team">
  <link rel="shortcut icon" href="../img/favicon.ico">
  <title>Data Types - PG-Strom Manual</title>
  <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>

  <link rel="stylesheet" href="../css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
  <link href="//fonts.googleapis.com/earlyaccess/notosansjp.css" rel="stylesheet">
  <link href="//fonts.googleapis.com/css?family=Open+Sans:600,800" rel="stylesheet">
  <link href="../custom.css" rel="stylesheet">
  
  <script>
    // Current page data
    var mkdocs_page_name = "Data Types";
    var mkdocs_page_input_path = "ref_types.md";
    var mkdocs_page_url = null;
  </script>
  
  <script src="../js/jquery-2.1.1.min.js" defer></script>
  <script src="../js/modernizr-2.8.3.min.js" defer></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script> 
  
</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
      <div class="wy-side-nav-search">
        <a href=".." class="icon icon-home"> PG-Strom Manual</a>
        <div role="search">
  <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
  </form>

  [<a href="../ja" style="color: #cccccc">Japanese</a> | <strong>English</strong>]

</div>
      </div>

      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
	<ul class="current">
	  
          
            <li class="toctree-l1">
		
    <a class="" href="..">Home</a>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../install/">Install</a>
	    </li>
          
            <li class="toctree-l1">
		
    <span class="caption-text">Tutorial</span>
    <ul class="subnav">
                <li class="">
                    
    <a class="" href="../operations/">Basic Operations</a>
                </li>
                <li class="">
                    
    <a class="" href="../sys_admin/">System Administration</a>
                </li>
                <li class="">
                    
    <a class="" href="../brin/">Index Support</a>
                </li>
                <li class="">
                    
    <a class="" href="../partition/">Partitioning</a>
                </li>
                <li class="">
                    
    <a class="" href="../troubles/">Trouble Shooting</a>
                </li>
    </ul>
	    </li>
          
            <li class="toctree-l1">
		
    <span class="caption-text">Advanced Features</span>
    <ul class="subnav">
                <li class="">
                    
    <a class="" href="../ssd2gpu/">SSD2GPU Direct SQL</a>
                </li>
                <li class="">
                    
    <a class="" href="../arrow_fdw/">Arrow_fdw</a>
                </li>
                <li class="">
                    
    <a class="" href="../gstore_fdw/">Gstore_fdw</a>
                </li>
                <li class="">
                    
    <a class="" href="../plcuda/">PL/CUDA</a>
                </li>
    </ul>
	    </li>
          
            <li class="toctree-l1">
		
    <span class="caption-text">References</span>
    <ul class="subnav">
                <li class=" current">
                    
    <a class="current" href="./">Data Types</a>
    <ul class="subnav">
            
    <li class="toctree-l3"><a href="#built-in-numeric-types">Built-in numeric types</a></li>
    

    <li class="toctree-l3"><a href="#built-in-date-and-time-types">Built-in date and time types</a></li>
    

    <li class="toctree-l3"><a href="#built-in-variable-length-types">Built-in variable length types</a></li>
    

    <li class="toctree-l3"><a href="#built-in-miscellaneous-types">Built-in miscellaneous types</a></li>
    

    <li class="toctree-l3"><a href="#built-in-range-data-types">Built-in range data types</a></li>
    

    <li class="toctree-l3"><a href="#extra-types">Extra Types</a></li>
    

    </ul>
                </li>
                <li class="">
                    
    <a class="" href="../ref_devfuncs/">Functions and Operators</a>
                </li>
                <li class="">
                    
    <a class="" href="../ref_sqlfuncs/">SQL Objects</a>
                </li>
                <li class="">
                    
    <a class="" href="../ref_params/">GUC Parameters</a>
                </li>
    </ul>
	    </li>
          
            <li class="toctree-l1">
		
    <a class="" href="../release_note/">Release Note</a>
	    </li>
          
        </ul>
      </div>
      &nbsp;
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="..">PG-Strom Manual</a>
      </nav>

      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="..">Docs</a> &raquo;</li>
    
      
        
          <li>References &raquo;</li>
        
      
    
    <li>Data Types</li>
    <li class="wy-breadcrumbs-aside">
      
    </li>
  </ul>
  <hr/>
</div>
          <div role="main">
            <div class="section">
              
                <h1>Data Types</h1>

<p>PG-Strom support the following data types for use on GPU device.</p>
<h1 id="built-in-numeric-types">Built-in numeric types</h1>
<table>
<thead>
<tr>
<th align="left">SQL data types</th>
<th align="left">Internal format</th>
<th align="left">Length</th>
<th align="left">Memo</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>smallint</code></td>
<td align="left"><code>cl_short</code></td>
<td align="left">2 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>integer</code></td>
<td align="left"><code>cl_int</code></td>
<td align="left">4 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>bigint</code></td>
<td align="left"><code>cl_long</code></td>
<td align="left">8 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>real</code></td>
<td align="left"><code>cl_float</code></td>
<td align="left">4 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>float</code></td>
<td align="left"><code>cl_double</code></td>
<td align="left">8 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>numeric</code></td>
<td align="left"><code>cl_ulong</code></td>
<td align="left">variable length</td>
<td align="left">mapped to 64bit internal format</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>When GPU processes values in <code>numeric</code> data type, it is converted to an internal 64bit format because of implementation reason.
It is transparently converted to/from the internal format, on the other hands, PG-Strom cannot convert <code>numaric</code> datum with large number of digits, so tries to fallback operations by CPU. Therefore, it may lead slowdown if <code>numeric</code> data with large number of digits are supplied to GPU device.
To avoid the problem, turn off the GUC option <code>pg_strom.enable_numeric_type</code> not to run operational expression including <code>numeric</code> data types on GPU devices.</p>
</div>
<h1 id="built-in-date-and-time-types">Built-in date and time types</h1>
<table>
<thead>
<tr>
<th align="left">SQL data types</th>
<th align="left">Internal format</th>
<th align="left">Length</th>
<th align="left">Memo</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>date</code></td>
<td align="left"><code>DateADT</code></td>
<td align="left">4 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>time</code></td>
<td align="left"><code>TimeADT</code></td>
<td align="left">8 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>timetz</code></td>
<td align="left"><code>TimeTzADT</code></td>
<td align="left">12 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>timestamp</code></td>
<td align="left"><code>Timestamp</code></td>
<td align="left">8 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>timestamptz</code></td>
<td align="left"><code>TimestampTz</code></td>
<td align="left">8 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>interval</code></td>
<td align="left"><code>Interval</code></td>
<td align="left">16 bytes</td>
<td align="left"></td>
</tr>
</tbody>
</table>
<h1 id="built-in-variable-length-types">Built-in variable length types</h1>
<table>
<thead>
<tr>
<th align="left">SQL data types</th>
<th align="left">Internal format</th>
<th align="left">Length</th>
<th align="left">Memo</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>bpchar</code></td>
<td align="left"><code>varlena *</code></td>
<td align="left">variable length</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>varchar</code></td>
<td align="left"><code>varlena *</code></td>
<td align="left">variable length</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>bytea</code></td>
<td align="left"><code>varlena *</code></td>
<td align="left">variable length</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>text</code></td>
<td align="left"><code>varlena *</code></td>
<td align="left">variable length</td>
<td align="left"></td>
</tr>
</tbody>
</table>
<h1 id="built-in-miscellaneous-types">Built-in miscellaneous types</h1>
<table>
<thead>
<tr>
<th align="left">SQL data types</th>
<th align="left">Internal format</th>
<th align="left">Length</th>
<th align="left">Memo</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>boolean</code></td>
<td align="left"><code>cl_bool</code></td>
<td align="left">1 byte</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>money</code></td>
<td align="left"><code>cl_long</code></td>
<td align="left">8 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>uuid</code></td>
<td align="left"><code>pg_uuid</code></td>
<td align="left">16 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>macaddr</code></td>
<td align="left"><code>macaddr</code></td>
<td align="left">6 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>inet</code></td>
<td align="left"><code>inet_struct</code></td>
<td align="left">7 bytes or 19 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>cidr</code></td>
<td align="left"><code>inet_struct</code></td>
<td align="left">7 bytes or 19 bytes</td>
<td align="left"></td>
</tr>
</tbody>
</table>
<h1 id="built-in-range-data-types">Built-in range data types</h1>
<table>
<thead>
<tr>
<th align="left">SQL data types</th>
<th align="left">Internal format</th>
<th align="left">Length</th>
<th align="left">Memo</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>int4range</code></td>
<td align="left"><code>__int4range</code></td>
<td align="left">14 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>int8range</code></td>
<td align="left"><code>__int8range</code></td>
<td align="left">22 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>tsrange</code></td>
<td align="left"><code>__tsrange</code></td>
<td align="left">22 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>tstzrange</code></td>
<td align="left"><code>__tstzrange</code></td>
<td align="left">22 bytes</td>
<td align="left"></td>
</tr>
<tr>
<td align="left"><code>daterange</code></td>
<td align="left"><code>__daterange</code></td>
<td align="left">14 bytes</td>
<td align="left"></td>
</tr>
</tbody>
</table>
<h1 id="extra-types">Extra Types</h1>
<table>
<thead>
<tr>
<th align="left">SQL data types</th>
<th align="left">Internal format</th>
<th align="left">Length</th>
<th align="left">Memo</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><code>float2</code></td>
<td align="left"><code>half_t</code></td>
<td align="left">2 bytes</td>
<td align="left">Half precision data type</td>
</tr>
<tr>
<td align="left"><code>reggstore</code></td>
<td align="left"><code>cl_uint</code></td>
<td align="left">4 bytes</td>
<td align="left">Specific version of regclass for gstore_fdw. Special handling at PL/CUDA function invocation.</td>
</tr>
</tbody>
</table>
              
            </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="../ref_devfuncs/" class="btn btn-neutral float-right" title="Functions and Operators">Next <span class="icon icon-circle-arrow-right"></span></a>
      
      
        <a href="../plcuda/" class="btn btn-neutral" title="PL/CUDA"><span class="icon icon-circle-arrow-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <!-- Copyright etc -->
    
  </div>

  Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
      
        </div>
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" style="cursor: pointer">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
      
        <span><a href="../plcuda/" style="color: #fcfcfc;">&laquo; Previous</a></span>
      
      
        <span style="margin-left: 15px"><a href="../ref_devfuncs/" style="color: #fcfcfc">Next &raquo;</a></span>
      
    </span>
</div>
    <script>var base_url = '..';</script>
    <script src="../js/theme.js" defer></script>
      <script src="../search/main.js" defer></script>

</body>
</html>
